package com.tianruan.dc.modules.userinfo.context;

import cn.hutool.core.util.ObjectUtil;
import com.tianruan.dc.common.utils.response.VResponse;
import com.tianruan.dc.modules.userinfo.entity.User;


import java.util.Objects;


public class ObjectResult {
    /*
    判断用户信息是否完整
     */
    public static VResponse<Object> getObjectResult(User user) {
        if (Objects.equals(user.getType(), "0")) {
            if(ObjectUtil.isEmpty(user.getCollege())){
                return VResponse.error(1000,"毕业院校不可为空");
                //Result.error("毕业院校不可为空！");
            }
            if(ObjectUtil.isEmpty(user.getJob())){
                return VResponse.error(1000,"从事行业不可为空！");
            }
            if(ObjectUtil.isEmpty(user.getPost())){
                return VResponse.error(1000,"职位不可为空！");
            }
            if(ObjectUtil.isEmpty(user.getWorkExp())){
                return VResponse.error(1000,"工作经验不可为空！");
            }
            if(ObjectUtil.isEmpty(user.getExcelField())){
                return VResponse.error(1000,"擅长领域不可为空！");
            }
            if(ObjectUtil.isNotEmpty(user.getOfficeId())){
                return VResponse.error(1000,"您的类型是导师，学院不需填写！");
            }
            if(ObjectUtil.isNotEmpty(user.getEnrollmentYear())){
                return VResponse.error(1000,"您的类型是导师，入学年份不需填写！");
            }
        }

        if (Objects.equals(user.getType(), "1")) {
            if(ObjectUtil.isEmpty(user.getOfficeId())){
                return VResponse.error(1000,"学院不可为空！");
            }
            if(ObjectUtil.isEmpty(user.getMajor())){
                return VResponse.error(1000,"专业不可为空！");
            }
            if(ObjectUtil.isEmpty(user.getEnrollmentYear())){
                return VResponse.error(1000,"入学年份不可为空！");
            }

            if(ObjectUtil.isNotEmpty(user.getCollege())){
                return VResponse.error(1000,"您的类型是学生,毕业院校不需填写");
            }
            if(ObjectUtil.isNotEmpty(user.getJob())){
                return VResponse.error(1000,"您的类型是学生,从事行业不需填写！");
            }
            if(ObjectUtil.isNotEmpty(user.getPost())){
                return VResponse.error(1000,"您的类型是学生,职位不需填写！");
            }
            if(ObjectUtil.isNotEmpty(user.getWorkExp())){
                return VResponse.error(1000,"您的类型是学生,工作经验不需填写！");
            }
            if(ObjectUtil.isNotEmpty(user.getExcelField())){
                return VResponse.error(1000,"您的类型是学生,擅长领域不需填写！");
            }
        }
        return null;
    }
}
